<template>
  <div class="shop-info">
    <div class="headers">
      <img :src="shopInfo.logo" alt="" />
      <p>{{ shopInfo.name }}</p>
    </div>
    <div class="conter">
      <div class="amount">
        <div>
          <p>{{ shopInfo.sell }}</p>
          <span>总销量</span>
        </div>
        <div>
          <p>{{ shopInfo.goodsCount }}</p>
          <span>全部宝贝</span>
        </div>
      </div>
      <div class="score">
        <table>
          <tr v-for="(item, index) in shopInfo.score" :key="index">
            <td>{{ item.name }}</td>
            <td :class="item.isBetter ? 'red' : 'green'">{{ item.score }}</td>
            <td :class="item.isBetter ? 'color-red' : 'color-green'">
              <span>{{ item.isBetter ? '高' : '低' }}</span>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div class="btn">
      <button>进店逛逛</button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    shopInfo: Object
  },
  data() {
    return {}
  },
  methods: {}
}
</script>

<style lang="less" scoped>
.shop-info {
  padding: 25px 10px;
  border-top: 5px solid #f2f5f8;
  border-bottom: 5px solid #f2f5f8;
  .headers {
    display: flex;
    align-items: center;
    padding: 0 0 20px;
    img {
      width: 45px;
      height: 45px;
      border: 1px solid #ccc;
      border-radius: 50%;
      margin-right: 10px;
    }
  }
  .conter {
    display: flex;
    .amount {
      flex: 49%;
      display: flex;
      justify-content: space-around;
      align-items: center;
      border-right: 1px solid rgba(0, 0, 0, 0.1);
      text-align: center;
      p {
        font-size: 18px;
        color: #333;
        margin-bottom: 5px;
      }
      span {
        font-size: 12px;
      }
    }
    .score {
      flex: 50%;
      display: flex;
      justify-content: center;
      font-size: 13px;
      tr {
        line-height: 20px;
        td:nth-child(2) {
          padding: 0 10px;
        }
      }
    }
  }
  .btn {
    text-align: center;
    padding-top: 15px;
    button {
      border: none;
      padding: 6px 45px;
      border-radius: 5px;
      font-size: 14px;
      color: #666;
      background-color: #f2f5f8;
    }
  }
}

td.green {
  color: #5ea732;
}
td.red {
  color: #f13e3a;
}
.color-green span {
  padding: 0 1px;
  color: #fff;
  background-color: #5ea732;
}
.color-red span {
  padding: 0 1px;
  color: #fff;
  background-color: #f13e3a;
}
</style>
